<%
# Copyright (C) 2015 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%= fields_for :settings, OpenObject.new(settings) do |f| %>
  <table style="width: 500px;" class="formtable">
    <tr>
      <td colspan="2">
        Get correct information from your <a href="https://console.developers.google.com/project">Google Developer Console</a>
      </td>
    </tr>
    <tr>
      <td><%= f.blabel :client_id, :en => "Client ID" %></td>
      <td>
        <%= f.text_field :client_id %>
      </td>
    </tr>

    <tr>
      <td><%= f.blabel :client_secret, :en => "Client Secret" %></td>
      <td>
        <%= f.password_field :client_secret %>
      </td>
    </tr>

    <tr>
      <td><%= f.blabel :redirect_uri, :en => "Redirect URI" %></td>
      <td>
        <%= f.text_field :redirect_uri %>
      </td>
    </tr>

    <tr>
      <td><%= f.blabel :auth_uri, :en => "Auth URI" %></td>
      <td>
        <%= f.text_field :auth_uri %>
      </td>
    </tr>


    <tr>
      <td><%= f.blabel :token_uri, :en => "Token URI" %></td>
      <td>
        <%= f.text_field :token_uri %>
      </td>
    </tr>

    <!-- a lot of work goes in to that bold 'OR' -->
    <tr>
      <td>
        <strong>OR</strong>
      </td>
    </tr>

    <tr>
      <td colspan="2"><%= mt(:description, <<-TEXT, :google_url => 'https://console.developers.google.com/project')
Paste the contents of client_secrets.json below. The text boxes above will be automatically filled in based on the content given below.
TEXT
      %></td>
    </tr>

    <tr>
      <td><%= f.blabel :client_secret_json, :en => "Client secrets json" %></td>
      <td>
        <%= f.text_area :client_secret_json, :rows => '4' %>
      </td>
    </tr>
  </table>
<% end %>
